             $(document).ready(function(){
                $("#tradeAddingForm").submit(function(e){
                    e.preventDefault();
                    var url = $(this).attr("action");
                    //console.log(url);
                    var data = $(this).serialize();
                    $.ajax({
                        url:url,
                        data:data,
                        success:function(data,success){
                            if (success === 'success')
                                {
                                    if(data.success)
                                        {
                                            window.location.reload();
                                        }else{
                                            alert(data.message);
                                        }
                                }
                        },
                        method:'POST'
                    });
                });
                
                     $('#datetimepicker1').datetimepicker({
                         //format: 'yyyy-mm-dd hh:ii'
                         //format: 'YYYY/MM/DD HH:mm'
                         format: 'MM/DD/YYYY HH:mm:mm'
                     });

                     $(".clear_icon2").click(function(){
                            var resp = confirm("Are you sure you want to delete?");
                            if(resp===true){
                                var table = $(this).attr("data-table");
                                var learnid = $(this).attr("data-learnid");
                                var teachid = $(this).attr("data-teachid");
                                //var epid = $(this).attr("data-epid");
                                //var description = $(this).attr("data-description");
                                var data={'table':table, 'learnid':learnid, 'teachid':teachid/*, 'epid':epid, 'description': description*/};
                                $.ajax({
                                    url:'tradepage/deleteTrade',
                                    data:data,
                                    type:'POST',
                                    dataType:'json',
                                    success:function(resp,success){
                                        if(success==='success'){
                                            if(resp.success){
                                                window.location.reload();
                                            }
                                        }
                                    }
                                });
                            }
                        });
                        
                    $(".profile_add_form .dynamic_selector").each(function(){
                            var dataSourceUrl = $(this).attr("data-source"); 
                            var $curSelect = $(this);
                            if(typeof dataSourceUrl !=='undefined' && dataSourceUrl!==""){
                                $.get(dataSourceUrl,function(resp,status){
                                      if(status==='success'){
                                          var response=$.parseJSON(resp);
                                          for(var i=0;i<response.length;i++){
                                              var single=response[i];
                                              var html = "<option value=\""+single.id+"\">"+single.name+"</option>";
                                              $curSelect.append(html);
                                          }
                                      }
                                });
                            }
                         });
 });             


